/**
 * @file /include/ui_core/main_window.hpp
 *
 * @brief Qt based gui for ui_core.
 *
 * @date November 2010
 **/
#ifndef ui_core_MAIN_WINDOW_H
#define ui_core_MAIN_WINDOW_H

/*****************************************************************************
** Includes
*****************************************************************************/

#include <QtGui/QMainWindow>
#include "ui_main_window.h"
#include "qnode.hpp"
#include "QProcess"
#include <QStandardItemModel>

/*****************************************************************************
** Namespace
*****************************************************************************/

namespace ui_core {

/*****************************************************************************
** Interface [MainWindow]
*****************************************************************************/
/**
 * @brief Qt central, all operations relating to the view part here.
 */
class MainWindow : public QMainWindow {
Q_OBJECT

public:
	MainWindow(int argc, char** argv, QWidget *parent = 0);
	~MainWindow();

	void ReadSettings(); // Load up qt program settings at startup
	void WriteSettings(); // Save qt program settings when closing

	void closeEvent(QCloseEvent *event); // Overloaded function
  void showNoMasterMessage();

public Q_SLOTS:
    /******************************************
    ** Auto-connections (connectSlotsByName())
    *******************************************/
    void on_actionAbout_triggered();
    void on_button_connect_clicked(bool check );
    void on_checkbox_use_environment_stateChanged(int state);

    void slot_cmd_input();// command line input
    void slot_update_image(QImage);//收到图像数据信号要执行的操作函数
    void slot_update_rectangle(int, int, int, int);
    void slot_sub_image();//发布按键点击下要执行的操作函数
    /******************************************
    ** Manual connections
    *******************************************/
    void updateLoggingView(); // no idea why this can't connect automatically

    void on_pbt_img_rect_clicked();

    void getSystemInfo();

    void time_update(); //时间更新槽函数，状态栏显示时间

    void mouseMoveEvent(QMouseEvent *event);

    void showBattery();
    void showBatteryIcon(QString fileName);
    void showWifi();
    void showWifiIcon(QString fileName);


private:
    Ui::MainWindowDesign ui;

    QNode qnode;
    QProcess *cmd_pro;

    QStandardItemModel *ItemModel;
};

}  // namespace ui_core

#endif // ui_core_MAIN_WINDOW_H
